package com.nondo.rdp.finance.domain.course;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;

/**
 * 首页-阶段课程
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "stage_course")
public class StageCourse extends BaseEntity {
	private static final long serialVersionUID = -4657543769627798892L;
	private Long id;// 主键
	private Course course;// 课程
	@Deprecated
	private CourseGroup courseGroup; // 课程组
	private Integer type; // 类型 0=新手上路|1=基本面选股|2=技术面选股
	
	//扩展字段
	private String name; // 课程名称

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @OneToOne
    @JoinColumn( name ="cid")
	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	@Transient
	@OneToOne
	@JoinColumn( name ="groupId")
	public CourseGroup getCourseGroup() {
		return courseGroup;
	}

	public void setCourseGroup(CourseGroup courseGroup) {
		this.courseGroup = courseGroup;
	}

    @Column(columnDefinition = "int default 0", nullable = false)
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Transient
	@JsonIgnore
	public String getName() {
		return name;
	}

	@JsonSetter
	public void setName(String name) {
		this.name = name;
	}
    
}
